package com.ak.server.system.service.impl;

import java.util.Arrays;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ak.server.system.entity.RoleDept;
import com.ak.server.system.mapper.RoleDeptMapper;
import com.ak.server.system.service.IRoleDeptService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service("roleDeptService")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class RoleDeptServiceImpl extends ServiceImpl<RoleDeptMapper, RoleDept>  implements IRoleDeptService {

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void deleteRoleDeptsByRoleId(String[] roleIds) {
		List<String> list = Arrays.asList(roleIds);
		baseMapper.delete(new LambdaQueryWrapper<RoleDept>().in(RoleDept::getRoleId, list));
	}

	@Override
	public int batchRoleDept(List<RoleDept> roleDeptList) {
		return this.batchRoleDept(roleDeptList);
	}

}
